package org.sxm.cloud.framework.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

/**
 * @Description MVC配置
 * @Author xmSheng
 * @Date 2024/1/23
 */
@Configuration
public class WebConfiguration implements WebMvcConfigurer {
    /**
     * 统一配置对象转换器，否则Controller返回字符串会报错
     * @param converters
     */
    @Override
    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
        converters.add(0, new MappingJackson2HttpMessageConverter());
    }



}
